using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Attributes.DomainAttributes;
using Baci.Net.ToolKit.ArcGISProGeoprocessor.Models.Enums;
using System.Collections.Generic;
using System.ComponentModel;

namespace Baci.ArcGIS._RasterAnalysisTools._DeepLearning
{
    /// <summary>
    /// <para>Classify Objects Using Deep Learning</para>
    /// <para>Runs a trained deep learning model on an input raster and an optional feature class to produce a feature class or table in which each input object or feature has an assigned class or category label.</para>
    /// <para>在输入栅格和可选要素类上运行经过训练的深度学习模型，以生成要素类或表，其中每个输入对象或要素都具有分配的类或类别标注。</para>
    /// </summary>    
    [DisplayName("Classify Objects Using Deep Learning")]
    public class ClassifyObjectsUsingDeepLearning : AbstractGPProcess
    {
        /// <summary>
        /// 无参构造
        /// </summary>
        public ClassifyObjectsUsingDeepLearning()
        {

        }

        /// <summary>
        /// 有参构造
        /// </summary>
        /// <param name="_inputRaster">
        /// <para>Input Raster</para>
        /// <para>The input image to classify. The image can be an image service URL, a raster layer, an image service, a map server layer, or an internet tiled layer.</para>
        /// <para>要分类的输入图像。影像可以是影像服务 URL、栅格图层、影像服务、地图服务器图层或 Internet 切片图层。</para>
        /// </param>
        /// <param name="_inputModel">
        /// <para>Input Model</para>
        /// <para>The deep learning model that will be used to classify objects in the input image. The input is the URL of a deep learning package (.dlpk) item that contains the path to the deep learning binary model file, the path to the Python raster function to be used, and other parameters such as preferred tile size or padding.</para>
        /// <para>将用于对输入图像中的对象进行分类的深度学习模型。输入是深度学习包 （.dlpk） 项的 URL，其中包含深度学习二进制模型文件的路径、要使用的 Python 栅格函数的路径以及其他参数，例如首选切片大小或填充。</para>
        /// </param>
        /// <param name="_outputName">
        /// <para>Output Name</para>
        /// <para>The name of the feature service containing the classified objects.</para>
        /// <para>包含分类对象的要素服务的名称。</para>
        /// </param>
        public ClassifyObjectsUsingDeepLearning(object _inputRaster, object _inputModel, object _outputName)
        {
            this._inputRaster = _inputRaster;
            this._inputModel = _inputModel;
            this._outputName = _outputName;
        }
        public override string ToolboxName => "Raster Analysis Tools";

        public override string ToolName => "Classify Objects Using Deep Learning";

        public override string CallName => "ra.ClassifyObjectsUsingDeepLearning";

        public override List<string> AcceptEnvironments => ["cellSize", "extent", "parallelProcessingFactor", "processorType"];

        public override object[] ParameterInfo => [_inputRaster, _inputModel, _outputName, _inputFeatures, _modelArguments, _classLabelField, _processingMode.GetGPValue(), _outObjects];

        /// <summary>
        /// <para>Input Raster</para>
        /// <para>The input image to classify. The image can be an image service URL, a raster layer, an image service, a map server layer, or an internet tiled layer.</para>
        /// <para>要分类的输入图像。影像可以是影像服务 URL、栅格图层、影像服务、地图服务器图层或 Internet 切片图层。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Raster")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _inputRaster { get; set; }


        /// <summary>
        /// <para>Input Model</para>
        /// <para>The deep learning model that will be used to classify objects in the input image. The input is the URL of a deep learning package (.dlpk) item that contains the path to the deep learning binary model file, the path to the Python raster function to be used, and other parameters such as preferred tile size or padding.</para>
        /// <para>将用于对输入图像中的对象进行分类的深度学习模型。输入是深度学习包 （.dlpk） 项的 URL，其中包含深度学习二进制模型文件的路径、要使用的 Python 栅格函数的路径以及其他参数，例如首选切片大小或填充。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Model")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _inputModel { get; set; }


        /// <summary>
        /// <para>Output Name</para>
        /// <para>The name of the feature service containing the classified objects.</para>
        /// <para>包含分类对象的要素服务的名称。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Name")]
        [Description("")]
        [Option(OptionTypeEnum.Must)]
        public object _outputName { get; set; }


        /// <summary>
        /// <para>Input Features</para>
        /// <para><xdoc>
        ///   <para>The feature service that identifies the location of each object or feature to be classified and labeled. Each row in the input feature service represents a single object or feature.</para>
        ///   <para>If no input feature service is specified, each input image will be classified as a single object. If the input image or images use a spatial reference, the output from the tool is a feature class in which the extent of each image is used as the bounding geometry for each labeled feature class. If the input image or images are not spatially referenced, the output from the tool is a table containing the image ID values and the class labels for each image.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>用于标识要分类和标注的每个对象或要素的位置的要素服务。输入要素服务中的每一行表示一个对象或要素。</para>
        ///   <para>如果未指定输入要素服务，则每个输入影像将被分类为单个对象。如果输入影像使用空间参考，则工具的输出为要素类，其中每个影像的范围将用作每个标注要素类的边界几何。如果未在空间上引用一个或多个输入图像，则工具的输出将是一个包含图像 ID 值和每个图像的类标签的表。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Input Features")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _inputFeatures { get; set; } = null;


        /// <summary>
        /// <para>Model Arguments</para>
        /// <para>The function model arguments to use for the classification. These are defined in the Python raster function class referenced by the input model. This is where you list additional deep learning parameters and arguments for experiments and refinement, such as a confidence threshold for adjusting the sensitivity. The names of the arguments are populated by the tool from the Python module on the Raster Analytics server.</para>
        /// <para>用于分类的函数模型参数。这些在输入模型引用的 Python 栅格函数类中定义。在这里，您可以列出用于实验和优化的其他深度学习参数和参数，例如用于调整灵敏度的置信度阈值。参数的名称由栅格分析服务器上的 Python 模块中的工具填充。</para>
        /// <para></para>
        /// </summary>
        [DisplayName("Model Arguments")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _modelArguments { get; set; } = null;


        /// <summary>
        /// <para>Class Label Field</para>
        /// <para><xdoc>
        ///   <para>The name of the field that will contain the class or category label in the output feature class.</para>
        ///   <para>If a field name is not specified, a new field named ClassLabel will be generated in the output feature class.</para>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>将在输出要素类中包含类或类别标注的字段的名称。</para>
        ///   <para>如果未指定字段名称，则将在输出要素类中生成一个名为 ClassLabel 的新字段。</para>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Class Label Field")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public object _classLabelField { get; set; } = null;


        /// <summary>
        /// <para>Processing Mode</para>
        /// <para><xdoc>
        ///   <para>Specifies how all raster items in a mosaic dataset or an image service will be processed. This parameter is applied when the input raster is a mosaic dataset or an image service.</para>
        ///   <bulletList>
        ///     <bullet_item>Process as mosaicked image—All raster items in the mosaic dataset or image service will be mosaicked together and processed. This is the default.</bullet_item><para/>
        ///     <bullet_item>Process all raster items separately—All raster items in the mosaic dataset or image service will be processed as separate images.</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para><xdoc>
        ///   <para>指定如何处理镶嵌数据集或影像服务中的所有栅格项目。当输入栅格为镶嵌数据集或影像服务时，将应用此参数。</para>
        ///   <bulletList>
        ///     <bullet_item>处理为镶嵌影像 - 镶嵌数据集或影像服务中的所有栅格项目都将一起镶嵌并进行处理。这是默认设置。</bullet_item><para/>
        ///     <bullet_item>单独处理所有栅格项目 - 镶嵌数据集或影像服务中的所有栅格项目都将作为单独的影像进行处理。</bullet_item><para/>
        ///   </bulletList>
        /// </xdoc></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Processing Mode")]
        [Description("")]
        [Option(OptionTypeEnum.optional)]
        public _processingMode_value _processingMode { get; set; } = _processingMode_value._PROCESS_AS_MOSAICKED_IMAGE;

        public enum _processingMode_value
        {
            /// <summary>
            /// <para>Process as mosaicked image</para>
            /// <para>Process as mosaicked image—All raster items in the mosaic dataset or image service will be mosaicked together and processed. This is the default.</para>
            /// <para>处理为镶嵌影像 - 镶嵌数据集或影像服务中的所有栅格项目都将一起镶嵌并进行处理。这是默认设置。</para>
            /// </summary>
            [Description("Process as mosaicked image")]
            [GPEnumValue("PROCESS_AS_MOSAICKED_IMAGE")]
            _PROCESS_AS_MOSAICKED_IMAGE,

            /// <summary>
            /// <para>Process all raster items separately</para>
            /// <para>Process all raster items separately—All raster items in the mosaic dataset or image service will be processed as separate images.</para>
            /// <para>单独处理所有栅格项目 - 镶嵌数据集或影像服务中的所有栅格项目都将作为单独的影像进行处理。</para>
            /// </summary>
            [Description("Process all raster items separately")]
            [GPEnumValue("PROCESS_ITEMS_SEPARATELY")]
            _PROCESS_ITEMS_SEPARATELY,

        }

        /// <summary>
        /// <para>Output Objects</para>
        /// <para></para>
        /// <para></para>
        /// <para></para>
        /// </summary>
        [DisplayName("Output Objects")]
        [Description("")]
        [Option(OptionTypeEnum.derived)]
        public object _outObjects { get; set; }


        public ClassifyObjectsUsingDeepLearning SetEnv(object cellSize = null, object extent = null, object parallelProcessingFactor = null)
        {
            base.SetEnv(cellSize: cellSize, extent: extent, parallelProcessingFactor: parallelProcessingFactor);
            return this;
        }

    }

}